Page History: Batches of Orders
Compare Page Revisions
Page Revision: 2012/01/23 11:34
Processing orders in batches is more efficient and faster than processing them individually. However, batches can only contain orders for the same account and market, additionally revision and pull batches must only have orders for the same ExecutingLoginID. Due to load balancing performed by the servers the orders for an account may be executed by different servers and have different ExecutingLoginID’s, though a single batch of orders will be executed by a single server and ExecutingLoginID.
Additionally, not all trading exchanges support batches of orders so part of the efficiency benefit is lost.
Order updates and fills occur the same for batches as they do for single orders. However, if you use the OrderUpdate events from the Position, Account or AccountList objects instead of from the Order object then you will receive the updates in batches as well.
To submit a batch of orders you first create an
OrderList.Submission object and then add orders to it. Once the batch is complete then you can submit it.
' Reference to the batch orders.
Private moOrder1 As Order
Private moOrder2 As Order
…
' Get an account to submit the order for.
Dim oAccount As Account = moAccounts(0)
' Get a market to submit the order in.
Dim oMarket As Market = moFilter(0)
' Create the batch submission object.
Dim oBatch As OrderList.Submission
oBatch = moAccounts.SubmitOrders(oAccount, oMarket)
' Add an order to the batch.
moOrder1 = oBatch.Add(BuySell.Buy, _
PriceType.Limit, _
TimeType.Normal, _
1, _
CDbl(107000))
' Add an order to the batch.
moOrder2 = oBatch.Add(BuySell.Buy, _
PriceType.Limit, _
TimeType.Normal, _
1, _
CDbl(107010))
' Submit the batch.
oBatch.Submit()